<?php
class C_Curd_Ajax extends ControllerAjaxBasic {

    public function view ($strNameOfModel = '') {
        if (empty($strNameOfModel)) {
            $this->_pageNotFound();
        }

        /* @var $objCurd M_Curd */
        $objCurd = $this->_createModel('Curd');
        $objCurd->init($strNameOfModel);

        $this->_initLanguage();

        $this->_newViewElement('Curd_View')
        ->_addVariable('options', $objCurd->getOptions())
        ->_addVariable('element', $objCurd->element($this->_GET_Item('id')));

        die($this->_render());

    }

    private function _initLanguage ($lang = 'Ru') {
        $this->_newViewElement('Curd_Languages_'.$lang);
    }

}